package edu.sctu.zhengsenwen.month201505.day20150524;


import java.util.ArrayList;
import java.util.List;

/**
 * Created by user15 on 2015/5/24.
 */
public class TextOne extends TextMore {


    public void getTercherInfo() {


        List<Teacher> list = sortNumber();

        for (int i = 0; i < list.size(); i++) {
            System.out.println("工号：" + list.get(i).getNumber() + "\t" + "职称：" + list.get(i).getPostion() + "\t"
                    + "性别" + list.get(i).getPostion() + "\t" + "课程：" + list.get(i).getPostion());

            System.out.println("老师所教学生");

            for (int j = 0; j < list.get(i).getStudent().size(); j++) {
                System.out.println(list.get(i).getStudent().get(j).getName());
            }
        }
    }


    public List<Student> getStudent(int code, List<Student> list) {

        List<Student> list1 = new ArrayList<>();

        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getGrade() > list.get(i).getGrade()) {
                list1.add(list.get(i));
            }
        }
        return list1;
    }


    public void getCode() {

        List<Teacher> listA = pritCoded();

        List<Student> listB = new ArrayList<>();

        for (int i = 0; i < listA.size(); i++) {
            listB = listA.get(i).getStudent();
        }



    AInterface aInterface = new AInterface() {
        @Override
        public void method(List<Student> list) {
            List<Student> list1 = getStudent(76, list);
            System.out.println("教授的学生中成绩大于75的学生：");
            for (int i = 0; i < list1.size(); i++) {

                System.out.println(list1.get(i).getName() + "\t");
            }
        }

    };

    aInterface.method(listB);
}


    public void getCourse() {

        List<Student> studentList = sortStudnt();
        List<List> ListAll = new ArrayList<List>();
        List ListAllcourse = new ArrayList<>();


        List ListChinese = new ArrayList<>();
        List ListMath = new ArrayList<>();
        List ListEnglish = new ArrayList<>();
        List ListHistory = new ArrayList<>();
        List ListBiology = new ArrayList<>();

        ListAll.add(ListChinese);
        ListAll.add(ListMath);
        ListAll.add(ListEnglish);
        ListAll.add(ListHistory);
        ListAll.add(ListBiology);


        ListChinese.add("语文");
        ListMath.add("数学");
        ListEnglish.add("英语");
        ListHistory.add("历史");
        ListBiology.add("化学");


        for (int i = 0; i < studentList.size(); i++) {
            for (int j = 0; j < studentList.get(i).getCourse().size(); j++) {
                if (studentList.get(i).getCourse().get(j) == "语文") {
                    ListChinese.add(studentList.get(i).getName());
                }
            }


            for (int j = 0; j < studentList.get(i).getCourse().size(); j++) {
                if (studentList.get(i).getCourse().get(j) == "数学") {
                    ListMath.add(studentList.get(i).getName());

                }
            }


            for (int j = 0; j < studentList.get(i).getCourse().size(); j++) {
                if (studentList.get(i).getCourse().get(j) == "英语") {
                    ListEnglish.add(studentList.get(i).getName());

                }
            }


            for (int j = 0; j < studentList.get(i).getCourse().size(); j++) {

                if (studentList.get(i).getCourse().get(j) == "历史") {
                    ListHistory.add(studentList.get(i).getName());
                }
            }


            for (int j = 0; j < studentList.get(i).getCourse().size(); j++) {
                if (studentList.get(i).getCourse().get(j) == "生物") {
                    ListBiology.add(studentList.get(i).getName());
                }

            }
        }



        int x = Math.max(ListChinese.size(),Math.max(ListEnglish.size(),
                Math.max(ListMath.size(), Math.max(ListHistory.size(), ListBiology.size()))));


        for(int i=0;i<ListAll.size();i++){
            if(ListAll.get(i).size() == x) {
                ListAllcourse.add(ListAll.get(i));
            }

        }

        for(int i=0;i<ListAllcourse.size();i++){
            System.out.println("所选课程最多的是:"+ ListAllcourse.get(i));
        }

        }
    }








